/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pb138.ulohy.uloha2.entities;

/**
 *
 * @author stefan
 */
public class Owner {
    
    private Long id;
    private String ssn;
    private String firstName;
    private String lastName;
    private String address;
    private String telephone;
    
    public Owner(String ssn, String firstName, String lastName) {
        if(null == ssn || ssn.isEmpty() || null == firstName || firstName.isEmpty() || null == lastName || lastName.isEmpty()) {
            throw new IllegalArgumentException("ssn, firstName nor lastName cannot be null/empty. ssn=" + ssn + ", firstName=" + firstName + ", lastName=" + lastName);
        }
        this.ssn = ssn;
        this.firstName = firstName;
        this.lastName = lastName;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getSsn() {
        return ssn;
    }

    public void setSsn(String ssn) {
        if(null == ssn || ssn.isEmpty()) {
            throw new IllegalArgumentException("ssn cannot be null/empty. ssn=" + ssn);
        }
        this.ssn = ssn;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        if(null == firstName || firstName.isEmpty()) {
            throw new IllegalArgumentException("firstName cannot be null/empty. firstName=" + firstName);
        }
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        if(null == lastName || lastName.isEmpty()) {
            throw new IllegalArgumentException("lastName cannot be null/empty. lastName=" + lastName);
        }
        this.lastName = lastName;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 59 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Owner other = (Owner) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }
    
}
